#pragma once


#include "../绘图框架.h"
#include "buffer/DX纹理缓存.h"
#include "buffer/S_DX顶点数组.h"


/*
#include <direct.h>

#include <wrl.h>
#include <wrl/client.h>
#include <dxgi1_4.h>
#include <d3d12.h>

#include <pix.h>
#include <DirectXColors.h>
#include <DirectXMath.h>



#if defined(_DEBUG)
#include <dxgidebug.h>
#endif

using namespace Microsoft::WRL;
*/


//#include "Common\d3dx12.h"



struct S_DirectX3D绘图框架: public S_绘图框架
{
	ID3D12Device4*	m_设备;
	IDXGIAdapter*	m_pWarpAdapter;
	ComPtr<ID3D12Fence>			m_Fence;

	ComPtr<IDXGISwapChain>		m_交换链;
	ComPtr<IDXGISwapChain1>		m_交换链1;
	ComPtr<IDXGISwapChain3>		m_交换链3;
	
	std::vector<ComPtr<ID3D12Resource>>	m_交换链缓存;
	ComPtr<ID3D12Resource>			m_DepthStencilBuffer;


	uint64			m_CurrentFence;
	uint32			m_CurrBackBuffer;

	uint32			m_RTV_size;
	uint32			m_DSV_size;
	uint32			m_CbvUav_size;


	D3D12_VIEWPORT	m_视口;
	D3D12_RECT		m_裁剪;



	// Heap data
	struct HeapData {
		ComPtr<ID3D12DescriptorHeap> pHeap;
		uint32_t usedEntries = 0;
	};
	HeapData m_渲染目标视图堆;



	S_DirectX3D绘图框架();



	bool			f_创建命令列队();


	bool			f_创建WIN交换链(HINSTANCE& hInstance, HWND& hWnd, ivec2 size);

	bool			f_创建描述符();

	bool			f_创建渲染目标视图();

	//bool			f_刷新命令列队();

	bool			f_创建深度模板视图(ivec2 size);

	


	void			f_重置视口(ivec2 size);


	//D3D12_CPU_DESCRIPTOR_HANDLE	f_当前后台缓冲() const ;
	ID3D12Resource*				f_CurrentBackBuffer() const;
	D3D12_CPU_DESCRIPTOR_HANDLE	f_CurrentBackBufferView() const;
	void						f_刷新命令列表();



	void*			f_get设备() { return m_设备; }
	void*			f_get命令列表();
	void*			f_get环境();



	S_帧缓存*		f_创建帧缓存();
	bool			f_绘制(S_逻辑设备& dev);
	void	f_alloc(S_逻辑设备& dev);
	void	f_End(S_逻辑设备& dev);
};










